package side_server;

import java.io.IOException;

import talk_server.Talker;

public class Server_Leave {
	public Server_Leave(Talker talker) throws IOException
	{
		String msg;
		System.out.println("SENDING: WHO");
		talker.write("WHO"); //Richiesta al client
		msg = talker.read(); //Ricevo il peer da rimuovere
		System.out.println("RECEIVED:" + msg);
		String[] peer = msg.split(" ");
		Server_Launch.getInstance().removePeer(peer[0], Integer.parseInt(peer[1]));
		System.out.println("OPERATION COMPLETE");
		talker.write("OK"); //Invio il segnale di fine operazioni
	}
}
